home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
basic
/
qbware.exe
/
PRNTSTAT.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-11-30
|
2KB
|
70 lines
'*****************************************************************************
'Copyright (c) 1987,1988 Marcel Madonna
'PRNTSTAT.BAS shows the use of a BIOS routine to check printer status.
'This can prevent those annoying device time-outs that occur when you
'run out of paper or the printer heats up a little.
'
' ********************* N O T E *************************
'
'This program cannot be used from the DOS prompt without Microsoft
'QuickBasic V4.0 and a registered copy of QBWARE.
'
'To compile it, at the DOS prompt type:
' bc PRNTSTAT;
' link /ex /noe PRNTSTAT,,,brun40 qbware;
' del PRNTSTAT.obj
' del PRNTSTAT.map
'To run it fromthe QuickBasic development environment, type:
'
' qb PRNTSTAT /l qbware
' [Shift] + F5
'*****************************************************************************
CLS
PRINT "PrntStat - Version 1.0 (C) Copyright 1987 AJM Software"
PRINT
' The following code segment will check the status of the printer
' at LPT1 and interrogate the results
Printer% = 0 'Use LPT1
CALL BsPStat(Printer%, Rc%) 'Get status of printer
Printer.Ready% = (Rc% AND 128) = 128 '1st bit indicates printer ready
Acknowledge% = (Rc% AND 64) = 64 '2nd bit indicates Ack
Out.of.Paper% = (Rc% AND 32) = 32 '3rd bit indicates out of paper
Selected% = (Rc% AND 16) = 16 '4th bit indicates Selected
IO.Error% = (Rc% AND 8) = 8 '5th bit indicates I/O Error
Timeout% = (Rc% AND 1) = 1 '8th bit indicates Timeout
IF Printer.Ready% THEN
PRINT " ...Printer at LPT1 reports Ready"
END IF
IF Acknowledge% THEN
PRINT " ...Printer at LPT1 reports Acknowledge"
END IF
IF Out.of.Paper% THEN
PRINT " ...Printer at LPT1 reports Out of Paper or Paper jam"
END IF
IF IO.Error% THEN
PRINT " ...Printer at LPT1 reports I/O error or Printer off-line"
END IF
IF Timeout% THEN
PRINT " ...Printer at LPT1 has timed out"
END IF
IF Selected% THEN
PRINT " ...Printer at LPT1 is selected"
END IF